package com.xzc.java8.B_Stream.j_numeric;

import java.util.stream.IntStream;
import java.util.stream.Stream;

public class NumericP1 {

    public static void main(String[] args) {
//        Stream<int[]> pythagoreanTriples = IntStream.rangeClosed(1, 100).boxed().flatMap(a -> IntStream.rangeClosed(a, 100)
//                .filter((b -> Math.sqrt(a * a + b * b) % 1 == 0)).mapToObj(b -> new int[]{a, b, (int) Math.sqrt(a * a + b * b)}));
//        pythagoreanTriples.limit(5).forEach(t -> System.out.println(t[0] + "," + t[1] + "," + t[2]));
//
//        IntStream.rangeClosed(1, 3).boxed().flatMap(a -> IntStream.rangeClosed(a, 3).mapToObj(b -> new int[]{a, b})).forEach(t -> System.out.println(t[0] + "," + t[1]));
        IntStream.rangeClosed(1, 3).boxed().flatMap(a -> IntStream.rangeClosed(1, 3).mapToObj(b -> new int[]{a, b})).forEach(t -> System.out.println(t[0] + "," + t[1]));
    }
}
